package cn.stazxr.component;

import java.awt.*;
import java.util.Arrays;

/**
 * Package: cn.stazxr.component
 * LabelTest
 *
 * @Author: stazxr
 * @Create: 2023/12/2
 * @Version: v1.0
 **/
public final class LabelTest {
    public static void main(String[] args) {
        Frame frame = new Frame("Hello world!");
        frame.setBounds(500, 300, 500, 300);
        frame.setFont(new Font("Microsoft YaHei UI",Font.ITALIC,15));
        frame.setLayout(null);

        Arrays.stream(GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts())
                .forEach(System.out::println);

        Label label = new Label("I am label!");
        label.setBounds(20,50,100,30);
        label.setFont(new Font("Microsoft YaHei UI",Font.BOLD,15));
        label.setBackground(new Color(102, 204, 255));  //setBackground依然是背景颜色，注意背景填充就是我们之前设定的大小
        label.setForeground(Color.BLACK);
        frame.add(label);
        frame.setVisible(true);
    }
}
